package com.sf.message.domain;

/**
 * Description:
 * User: xsj
 * Date: 2018-05-07
 * Time: 11.00
 */
public enum EnumUserCode {
    regType(10021001,"注册用户发送验证码类型")
    ,updatePws(10021002,"修改密码发送验证码类型")
    ,retrievePws(10021003,"找回密码发送验证码类型")
    ,verificationCodeSuccess(10031001,"验证成功")
    ,verificationCodeError(10031002,"验证码输入错误")
    ,verificationCodeOvertime(10031003,"手机号码未验证或验证码超时");
    private int code;
    private String msg;

    EnumUserCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getCodeStr() {
        return code + "";
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public EnumUserCode setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public static String getMsgByCode(int code) {
        EnumUserCode[] values = EnumUserCode.values();
        for (EnumUserCode ec : values) {
            if (ec.code == code) {
                return ec.msg;
            }
        }
        return "";
    }
}
